package com.drinks.yiniang.common.recycler.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.drinks.yiniang.App;
import com.hansen.library.utils.ScreenSizeUtils;

/**
 * Created by han on 2019/2/16 0016.
 */

public class InvoiceGoodsItemSpacesDecoration extends RecyclerView.ItemDecoration {
    private int space;

    public InvoiceGoodsItemSpacesDecoration(int space) {
        this.space = ScreenSizeUtils.dp2px(App.getInstance().getApplicationContext(), space);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        // Add top margin only for the first item to avoid double space between items
        outRect.left = space / 2;
        outRect.right = space / 2;
    }
}
